package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.DrugNoticeMapper;
import com.ruoyi.yljf.domain.DrugNotice;
import com.ruoyi.yljf.service.IDrugNoticeService;

import javax.annotation.Resource;

/**
 * 药材笔记Service业务层处理
 * 
 * @author metaee
 * @date 2025-03-26
 */
@Service
public class DrugNoticeServiceImpl extends ServiceImpl<DrugNoticeMapper, DrugNotice> implements IDrugNoticeService {
    @Resource
    private DrugNoticeMapper drugNoticeMapper;
    
    /**
     * 查询药材笔记列表
     * 
     * @param drugNotice 药材笔记
     * @return 药材笔记
     */
    @Override
    public List<DrugNotice> selectDrugNoticeList(DrugNotice drugNotice) {
    	LambdaQueryWrapper<DrugNotice> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(drugNotice.getUserId())) {
			queryWrapper.eq(DrugNotice::getUserId, drugNotice.getUserId());
		}
        if (StringUtils.isNotEmpty(drugNotice.getUserName())) {
			queryWrapper.like(DrugNotice::getUserName, drugNotice.getUserName());
		}
        if (StringUtils.isNotEmpty(drugNotice.getAvatar())) {
			queryWrapper.eq(DrugNotice::getAvatar, drugNotice.getAvatar());
		}
        if (StringUtils.isNotNull(drugNotice.getCurId())) {
			queryWrapper.eq(DrugNotice::getCurId, drugNotice.getCurId());
		}
        if (StringUtils.isNotEmpty(drugNotice.getName())) {
			queryWrapper.like(DrugNotice::getName, drugNotice.getName());
		}
        if (StringUtils.isNotEmpty(drugNotice.getNoticeContent())) {
			queryWrapper.eq(DrugNotice::getNoticeContent, drugNotice.getNoticeContent());
		}
        if (StringUtils.isNotNull(drugNotice.getLikes())) {
			queryWrapper.eq(DrugNotice::getLikes, drugNotice.getLikes());
		}
        if (StringUtils.isNotNull(drugNotice.getCreatTime())) {
			queryWrapper.eq(DrugNotice::getCreatTime, drugNotice.getCreatTime());
		}
        return drugNoticeMapper.selectList(queryWrapper);
    }
}
